﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Data.SQLite;

namespace DialogsEditor.DAO
{
    class ConnFactory
    {
        private static readonly ConnFactory _instance = new ConnFactory();
        //public static string SERVER = "localhost";
        //public static string NAMEBD = "dialogedit";

        private ConnFactory()
        {
        }

        public static ConnFactory getInstancia()
		{
			return _instance;
		}

        public SQLiteConnection GetConnDialog()
        {

            string database = AppDomain.CurrentDomain.BaseDirectory + "dialogeditor.s3db";
            string connectionString = @"Data Source=" + Path.GetFullPath(database) + ";FailIfMissing=True;Version=3;Pooling=False;Max Pool Size=100;";
            return new SQLiteConnection(connectionString);
        }

        public SQLiteConnection GetConnLevel()
        {

            string database = AppDomain.CurrentDomain.BaseDirectory + "leveleditor.s3db";
            string connectionString = @"Data Source=" + Path.GetFullPath(database) + ";FailIfMissing=True;Version=3;Pooling=False;Max Pool Size=100;";
            return new SQLiteConnection(connectionString);
        }
		/*public MySqlConnection getConexao()
		{
            string conn = "Persist Security Info=False;server="+SERVER+";database=" + NAMEBD + ";uid=root;" +
"server="+SERVER+";database=" + NAMEBD + ";uid=root;pwd=root";
			//string conn = ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ToString();
			return new MySqlConnection(conn);
		}

        public MySqlConnection getTestConexao(string server, string name)
        {
            string conn = "Persist Security Info=False;server=" + server + ";database=" + name + ";uid=root;" +
"server=" + server + ";database=" + name + ";uid=root;pwd=root";
            //string conn = ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ToString();
            return new MySqlConnection(conn);
        }*/
    }
}
